string sqltxt="insert to event_log (event) value ( event=@event ) set @logid=SCOPE_INDENTITY()"
SQLCOMMAND cmd1=new sqlcommand(sqltxt,conn)
cmd.Parameters.add("@event",SqlDbType.Char);
cmd.Parameters.[@event].Value="test msg error";
SqlParameter pmtLogid=new SqlParameter("@logid",sqlDbType.Int);
pmtLogid.Direction=ParameterDirection.Output;
cmd.Parameters.add(pmtLogid);
cmd.ExcuteNonQuery();
int nLogID=(int)pmtLogid.Value;